package com.lcz.authority.common.domain.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.lcz.authority.common.domain.BaseEntity;
import com.zhou.starter.jpacomment.annotation.ColumnComment;
import com.zhou.starter.jpacomment.annotation.TableComment;
import lombok.Data;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.ArrayList;
import java.util.List;

/**
 * @author lcz
 * @desc 部门表 sys_dept
 * @mail lcz_0130@163.com
 * @date 2024/06/17
 */
@Data
@TableName("sys_dept")
@Table(name = "sys_dept")
@Entity
@TableComment("部门表")
public class SysDeptEntity extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 部门ID
     */
    @Id
    @TableId(type = IdType.ASSIGN_ID)
    @ColumnComment("部门ID")
    private Long deptId;

    /**
     * 父部门ID
     */
    @ColumnComment("父部门ID")
    private Long parentId;

    /**
     * 祖级列表
     */
    @ColumnComment("祖级列表")
    private String ancestors;

    /**
     * 部门名称
     */
    @ColumnComment("部门名称")
    private String deptName;

    /**
     * 显示顺序
     */
    @ColumnComment("显示顺序")
    private Integer orderNum;

    /**
     * 负责人
     */
    @ColumnComment("负责人")
    private String leader;

    /**
     * 联系电话
     */
    @ColumnComment("联系电话")
    private String phone;

    /**
     * 邮箱
     */
    @ColumnComment("邮箱")
    private String email;

    /**
     * 部门状态:0正常,1停用
     */
    @ColumnComment("部门状态:0正常,1停用")
    private String status;

    /**
     * 删除标志（0代表存在 2代表删除）
     */
//    @TableField(exist = false)
//    @Transient
//    private String delFlag;

    /**
     * 父部门名称
     */
    @TableField(exist = false)
    @Transient
    private String parentName;

    /**
     * 子部门
     */
    @TableField(exist = false)
    @Transient
    private List<SysDeptEntity> children = new ArrayList<>();
}
